import { exInput, exSwitch, exRequestData } from '@ve/common/components/extension'
import { componentId } from '@/utils/unique'
// import { componentId } from '@/utils/unique'
export default {
  VERSION: '20220408',
  type: 'uiCirculationForm',
  //组件类型
  name: '循环表单',
  icon: 'information-line',
  svg: 'biaodanfuzhizhuanweidandubiaodan',
  //数据别名
  // dataName: 'uiDynamicForm_data',
  //子组件列表
  list: [
    {
      _id: `uiCirculationFormHeader_${componentId(6)}`,
      type: 'uiCirculationFormItem',
      actions: [],
      name: '循环表单-表头',
      label: '循环表单-表头',
      list: [],
    },
    {
      _id: `uiCirculationFormContent_${componentId(6)}`,
      type: 'uiCirculationFormItem',
      actions: [],
      name: '循环表单-内容',
      label: '循环表单-内容',
      list: [],
    },
  ],
  moudleList: [],
  dataList: [],
  _dataList: [],
  headerList: [],
  oldFormData: {},
  //数据集合 表单 列表等等
  data: {
    requestData: {},
    //表单数据
    formData: [],
    requestListData: [],
  },
  //表单验证
  rules: {},
  //扩展
  extension: {
    api: exInput('Api接口', ''),
    method: exInput('Method', ''),
    getDataKey: exInput('获取数据Key', ''),
    requestData: exRequestData('自定义参数', [
      { key: '#LIMIT#', value: 1 },
      { key: '#PAGE_SIZE#', value: 50 },
    ]),
    getFrom: {
      type: 'exGetDownload',
      name: '绑定表单',
      title: '绑定表单',
      value: [],
      hasCheckbox: false,
      treeData: '$getPageModules',
    },
    bindFromKey: exInput('绑定表单KEY', 'header'),
    fromKey: exInput('当前表单KEY', 'detail'),
  },
  //交互
  interaction: [],
  //条件、逻辑指令
  logicInstruction: [],
  //数据源绑定
  dataSourceBind: {
    sourceId: {
      type: 'exGetDataSource',
      name: '组件ID',
      value: {
        type: 1,
        source: [],
      },
    },
    // dataKey: exInput('数据Key', ''),
    getDataKey: exInput('数据Key', '', '获取数据的 key 的集合，多个 key 用 “,” 分隔，如需获取全部数据则不填写'),
    hasParam: exSwitch('当参数用', false, '默认当数据使用,开启当参数使用'),
  },
}
